{% extends "base.html" %}
{% block css %}
<link rel="stylesheet" type="text/css" href="http://yui.yahooapis.com/2.5.2/build/assets/skins/sam/skin.css">
<style type="text/css">
    textarea {
        width: 600px;
        height: 300px;
    }
    
    input[ type = text ] {
        width: 600px;
    }
</style>
{% endblock %}
{% block js %}<script type="text/javascript" src="http://yui.yahooapis.com/2.5.2/build/yahoo-dom-event/yahoo-dom-event.js"></script>
<script type="text/javascript" src="http://yui.yahooapis.com/2.5.2/build/element/element-beta-min.js"></script>
<script src="http://yui.yahooapis.com/2.5.2/build/container/container_core-min.js"></script>
<script src="http://yui.yahooapis.com/2.5.2/build/menu/menu-min.js"></script>
<script src="http://yui.yahooapis.com/2.5.2/build/button/button-min.js"></script>
<script src="http://yui.yahooapis.com/2.5.2/build/editor/editor-beta-min.js"></script>
<script type="text/javascript">
    var myEditor = new YAHOO.widget.Editor('id_content', {
        height: '300px',
        width: '600px',
        dompath: true, //Turns on the bar at the bottom 
        animate: true //Animates the opening, closing and moving of Editor windows 
    });
    myEditor.render();
    
    function submitForm(){
        document.mainForm.id_content.value = myEditor.saveHTML();
        document.mainForm.submit();
    }
</script>
{% endblock %}
{% block content %}<h1>添加新文章</h1>
<form name="mainForm" method="post" action="" onsubmit="submitForm();">
    {{form.as_p}}
    <input type="submit" value="保存"/>
</form>
{% endblock %}